<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org"><!--namespace-->
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
    <link th:src="@{plugin/bootstrap/bootstrap.css}" rel="stylesheet"/><!--静态资源，默认在\src\main\resources\static-->
    <link th:src="@{plugin/bootstrap/bootstrap-theme.css}" rel="stylesheet"/>

    <title th:text="${title}"></title>
</head>
<body>

<div class="panel panel-primary">
    <div class="panel-heading">
        <h3 class="panel-title">模板 thymeleaf </h3>
    </div>
    <div class="panel-body">
        <span th:text="${title}"></span>
    </div>
</div>

<div th:if="${not #lists.isEmpty(personList)}">
    <div class="panel panel-primary">
        <div class="panel-heading">
            <h3 class="panel-title">列表</h3>
        </div>
        <div class="panel-body">
            <ul th:class="list-group">
                <li th:class="list-group-item" th:each="person:${personList}">
                    <span th:text="${person.name}"></span>
                    <span th:text="${person.age}"></span>
                    <button th:class="btn" th:onclick="'getName(\'' + ${person.name} + '\')'">获取名字</button>
                </li>
            </ul>
        </div>
    </div>

</div>


<script th:inline="javascript">
    // js中获取model
    var title = [[${title}]];
    console.info(title);

    function getName(name) {
        console.log(name);
    }

</script>


<script th:src="@{plugin/jquery/jquery-3.1.0.js}"></script>
<script th:src="@{plugin/bootstrap/bootstrap.js}"></script>
</body>
</html>